<template>
  <div>
    <Search
      :semesterData="semesterData"
      :classData="classData"
      :gradeData="gradeData"
    />
    <List />
    <Add
      :semesterData="semesterData"
      :classData="classData"
      :gradeData="gradeData"
    />
    <StudentList />
    <AddStudent />
  </div>
</template>
<script>
import { eduTierQuery } from '@/api/admin/teach/eduTier.js'
export default {
  components: {
    List: () => import('./List.vue'),
    Search: () => import('./Search.vue'),
    Add: () => import('./Add.vue'),
    AddStudent: () => import('./AddStudent.vue'),
    StudentList: () => import('./StudentList.vue'),
  },
  data() {
    return {
      classData: [], //班级
      gradeData: [], //年级
      semesterData: [], //学期
    }
  },
  mounted() {
    this.getClass()
  },
  methods: {
    //班级、年级、学期
    getClass() {
      eduTierQuery({ page: 1, limit: 999 }).then((res) => {
        let data = res.data.data
        this.semesterData = data.filter((v) => v.type == 1)
        this.gradeData = data.filter((v) => v.type == 2)
        this.classData = data.filter((v) => v.type == 3)
      })
    },
  },
}
</script>